package org.esprit.ocm.server.dao.impl;

import java.util.List;

import org.esprit.ocm.dto.impl.ServerDto;
import org.esprit.ocm.dto.impl.UserDto;
import org.esprit.ocm.server.dao.ServerDao;
import org.esprit.ocm.server.dao.hibernate.BaseDaoHibernate;
import org.hibernate.Query;
import org.hibernate.Session;

public class ServerDaoImpl extends BaseDaoHibernate<ServerDto> implements ServerDao {

	public ServerDaoImpl(Class<ServerDto> _type) {
		super(_type);
		// TODO Auto-generated constructor stub
	}
	
	@Override
	protected void initDao() throws Exception {
		// TODO Auto-generated method stub
		super.initDao();
	}

	public List<ServerDto> findServerByUser(UserDto _o) {
		Session session = getSession();
		Query query = session.createQuery("from ServerDto s where s.user = :user");
		query.setParameter("user", _o);
		List<ServerDto> l = query.list();

		return l;
	}

}
